package com.mzj.saas.jobs.bill.repository;

import com.mzj.saas.jobs.bill.entity.SmartLockFingerprint;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

import javax.transaction.Transactional;
import java.util.List;

public interface SmartLockFingerprintRepository extends PagingAndSortingRepository<SmartLockFingerprint, Long>, JpaSpecificationExecutor<SmartLockFingerprint> {

	List<SmartLockFingerprint> findByLockAuthId(Long lockAuthId);
	
	List<SmartLockFingerprint> findByLockId(Long lockId);
	
	SmartLockFingerprint findByLockAuthIdAndFingerprintIndexNum(Long lockAuthId, Integer fingerprintIndexNum);
	
	Integer countByLockAuthId(Long lockAuthId);
	
	SmartLockFingerprint findByLockAuthIdAndFingerprintIndex(Long lockAuthId, Integer fingerprintIndex);
	
	@Transactional
    void deleteByLockAuthId(Long lockAuthId);

	int deleteByLockId(Long lockId);
}
